/*
 *  ATmpCrumb.cpp
 *  libavid
 *
 *  Created by Peter on 26.02.12.
 *  Copyright 2012 __MyCompanyName__. All rights reserved.
 *
 */
#include "ATmpCrumb.h"
#include "AStream.h"

A_IMPLEMENT_CLASS( 'TMBC', ATmpCrumb, AMCMobRef );

void ATmpCrumb::readFromStream( AStream& str, const AObjDoc& objd )
{
	AMCMobRef::readFromStream( str, objd );
	
	UInt8 tagMark, version;
	str.readPod( tagMark );
	str.readPod( version );
	TR_ASSERT( tagMark == 0x02 );
	TR_ASSERT( version == 0x03 );
	
	str.readPod( _compOffset );
	str.readPod( _attributes );
	_rgbColor.readFromStream( str ); 

	str.readPod( tagMark );
	TR_ASSERT( tagMark == 0x03 );
}

void ATmpCrumb::writeToStream( AStream& str ) const
{	
	AMCMobRef::writeToStream( str );
	
	// Write the TagMark version number
	str.writePod< UInt8 >( 0x02 );
	str.writePod< UInt8 >( 0x01 );
	
	// ...
	
	// Write the end TagMark
	str.writePod< UInt8 >( 0x03 );
}
#define TRACE_FIELD( x ) "\t" #x ": " << x << std::endl

void ATmpCrumb::dump( std::ostream& str ) const
{
	str << "ATmpCrumb {" << std::endl;
	
	str << "\t";
	AMCMobRef::dump( str );
	str << std::endl;
	
	str << TRACE_FIELD( _compOffset );
	str << TRACE_FIELD( _attributes );
	str << TRACE_FIELD( _rgbColor );
	
	str << "}" << std::endl;
}